/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mongoosehome.web.login.service;

import com.mongoosehome.web.common.domain.TRole;
import com.mongoosehome.web.common.domain.TUser;
import com.mongoosehome.web.login.dao.RoleDao;
import com.mongoosehome.web.login.dao.UserDao;
import com.mongoosehome.web.util.PageInfo;
import java.util.List;

/**
 *
 * @author Administrator
 * 用户管理服务接口。
 */
public class UserServiceImpl implements UserService{
    
    private UserDao userDao;
    private RoleDao roleDao;
     /**
     * @param userDao the userDao to set
     */
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    public void setRoleDao(RoleDao roleDao) {
        this.roleDao = roleDao;
    }
    
    /**
     * 增加用户和更新用户。 
     */
    @Override
    public void saveUser(TUser user) {
        this.userDao.saveUser(user);
    }

    @Override
    public void updateUser(TUser user){
        this.userDao.updateUser(user);
    }

    @Override
    public TUser getUser(int userid) {
        return this.userDao.getUser(userid);
    }

    @Override
    public List<TUser> getUserListByEmail(String email) {
        return this.userDao.getUserListByEmail(email);
    }

    @Override
    public TUser getUserByUserName(String userName) {
       return this.userDao.getUserByUserName(userName);
    }

    @Override
    public PageInfo getUserByPage(int pageNo,int maxResult) {
      return this.userDao.getUserByPage(pageNo, maxResult);
    }
    

    @Override
    public List<TRole> getAllRoles(){
        return this.roleDao.getAllRoles();
    }
}
